#include "Human.h"

Human::Human(Ogre::SceneNode* pHumanNode) : _pHumanNode(pHumanNode) { reset(); }

void
Human::updatePosition(Ogre::Vector3 vt) {

  Ogre::Vector3 ogrePos;
  OpenSteer::Vec3 steerPos;

  ogrePos = _pHumanNode->getPosition();
  steerPos.x = ogrePos.x;
  steerPos.y = ogrePos.y;
  steerPos.z = ogrePos.z;

  _pHumanNode->translate(vt);
  setPosition(steerPos);
}

void
Human::reset() {

	// TODO Jugar con estos parametros
	OpenSteer::MyVehicle::reset();			// reset the vehicle
	setSpeed(0.5f);											// speed along Forward direction.
	setMaxForce(0.5f);									// steering force clipped to magnitude
	setMaxSpeed(4);											// velocity is clipped to this magnitude
}

void
Human::update(const float currentTime, const float elapsedTime) {

	applySteeringForce(steerForWander(elapsedTime).setYtoZero(), elapsedTime);
}

void
Human::draw() {

	_pHumanNode->setPosition(position().x, position().y, position().z);
}

